<?php 

function send_load_admin_feedback()
{
   if(isset($_SESSION['logged_in']) && $_SESSION['permissions'] == "Admin")
      return true;
}

function send_menu_admin_feedback() 
{
   return "<a href=?q=admin_feedback>Read Feedback</a><br>";
}

function send_content_admin_feedback() 
{
   if(isset($_GET['q']) && $_GET['q'] == "admin_feedback")
   {
      $query = "select * from feedback";
      $result = mysql_query($query);
      $num = mysql_num_rows($result);
      if($num == 0)
         return "No feedback available";

      $content = "";
      $count = 1;
      while($row = mysql_fetch_array($result))
      {
         $content .= "$count. Message from $row[0] $row[1], $row[2]<br><br>";
         $content .= "$row[3]<br>";
         $content .= "<a href=?q=admin_feedback_delete&id=$row[id]>Delete record</a><br><hr>";
         $count++;
      }      
     
      return $content;
   }
   else if(isset($_GET['q']) && $_GET['q'] == "admin_feedback_delete")
   {
      $id = $_GET['id'];
      $query = "delete from feedback where id = $id";
      $result = mysql_query($query);
      if(!$result)
         return "Record not deleted";
      else
         return "Record deleted";
   }
}

function send_content_other_admin_feedback() 
{

}

?>
